using System.Collections.Generic;
using System.Linq;
using UnityEngine;

[CreateAssetMenu(fileName = "Effect30-向后移动一格", menuName = "Skill/Effect/Effect30-向后移动一格", order = 30)]
public class Effect30 : EffectBase
{
    public override void Apply(Pair pair, GameEvent e, List<Chess> targets)
    {
        if(targets == null || targets.Count == 0) return;

        foreach (var chess in targets)
        {
            if (chess.GetChessSide() == ChessSide.Player2)
            {
                ChessManager.GetInstance().MoveChess(chess.ChessDetail.Position,chess.ChessDetail.Position+Vector2Int.up);
            }
            else
            {
                ChessManager.GetInstance().MoveChess(chess.ChessDetail.Position,chess.ChessDetail.Position-Vector2Int.up);
            }
        }
    }
}